import java.util.Comparator;




public class WarehouseComparatorCapacity implements Comparator<Warehouse>
{
	boolean ascending;
	
	public WarehouseComparatorCapacity(boolean ascending)
	{
		this.ascending = ascending;
	}
	
	public int compare(Warehouse w1, Warehouse w2)
	{
		if(ascending == true)
		{
	       return w1.capacity >= w2.capacity ? 1 : 0;
	    }
		else
		{
	    	return w1.capacity >= w2.capacity ? 0 : 1;
	    }
	}
}
